﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Space
{
    public class SolarSystem : Modelled
    {
        List<Planet> planets = new List<Planet>();
        public List<Planet> Planets { get { return planets; } }

        List<Building> buildings = new List<Building>();
        public List<Building> Buildings { get { return buildings; } }

        public float Mass { get; set; }

        public SolarSystem()
        {
            Mass = 1;
        }

        public override void Draw(ref Matrix projection, ref Matrix view)
        {
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (Effect effect in mesh.Effects)
                {
                    effect.CurrentTechnique = effect.Techniques["Technique1"];
                    effect.Parameters["World"].SetValue(Matrix.CreateScale(1.5f) * Matrix.CreateTranslation(Position));
                    effect.Parameters["Projection"].SetValue(projection);
                    effect.Parameters["View"].SetValue(view);
                    effect.Parameters["DiffuseColor"].SetValue(Color.OrangeRed.ToVector3());
                    //effect.Parameters["EmissiveColor"].SetValue(Color.Orange.ToVector3());
                    effect.Parameters["EmissiveColor"].SetValue(new Vector3(0.2f));
                    effect.Parameters["Light1Direction"].SetValue(Vector3.Up);
                    effect.Parameters["Texture"].SetValue(Texture);
                }
                mesh.Draw();
            }
        }

        public void AddBuilding(Building b)
        {
            buildings.Add(b);
        }
    }
}
